package com.example.vv.service.impl;

import com.example.vv.domain.Developer;
import com.example.vv.mapper.DeveloperMapper;
import com.example.vv.service.DeveloperService;
import com.github.dreamroute.mybatis.pro.service.service.AbstractServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 描述：// TODO
 *
 * @author w.dehai.2024/5/9.20:37
 */
@Service
@RequiredArgsConstructor
public class DeveloperServiceImpl extends AbstractServiceImpl<Developer, Long> implements DeveloperService {

    private final DeveloperMapper developerMapper;
    private final ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @Override
    @Transactional
    public void insert() {
        Developer developer = new Developer();
        developer.setName("yz");
        developerMapper.insert(developer);
    }

    @Override
    @Transactional
    public void index() {
        System.err.println(Thread.currentThread().getName());
        mm();
        nn();
    }

    @Async
    public void mm() {
        System.err.println(Thread.currentThread().getName());
    }

    @Async
    public void nn() {
        System.err.println(Thread.currentThread().getName());
    }
}
